#include <iostream>
#include <algorithm>
using namespace std;
const int N=2e5+10;
int a[N];
int n;
int f(int x)
{
    int left=1;int right=n;
    while(left<right)
    {
         int mid=(right+left)/2;
         if(a[mid]>=x)right=mid;
         else left=mid+1;
    }
    if(a[left]>x)return 0;
    int retleft=left;
    left=1;right=n;
    while(left<right)
    {
         int mid=(right+left+1)/2;
         if(a[mid]<=x)left=mid;
         else right=mid-1;
    }
    if(a[left]<x)return 0;
    return left-retleft+1;
}
int main()
{
    cin>>n;
    int c;cin>>c;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    sort(a+1,a+1+n);
    long long sum=0;
    for(int i=1;i<=n;i++)
    {
        int tmp=f(a[i]-c);
        sum+=tmp;
    }
    cout<<sum;

    return 0;
}
